let arr1 =[1,2,4,5,6,7,1]
let arr2 = [2,4,5,8,9,3,5]

//求两个数组的交集
let s1 = new Set(arr1)
let s2 = new Set(arr2)
let newarr = []
arr2.forEach(value=>{
    if(s1.has(value))
      newarr.push(value)
})
console.log([...new Set(newarr)])
console.log(Array.from(new Set(newarr)))

//求两个数组的差集
let bjarr = []
arr1.forEach(value=>{
    if(!s2.has(value))
     bjarr.push(value)
})
arr2.forEach(value=>{
    if(!s1.has(value))
     bjarr.push(value)
})
console.log([...new Set(bjarr)])

let obj = {a:2}
let set = new Set()
set.add(obj).add(obj)
console.log(set)